package cn.bytecollege.user.controller;

import cn.bytecollege.user.service.AddressService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "AddressDeleteController",value="/user/addressDelete")
public class AddressDeleteController extends HttpServlet {
      AddressService addressService=null;
      public AddressDeleteController(){
          addressService=new AddressService();
      }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String addressId=request.getParameter("addressdId");
        addressService.deleteById(Integer.valueOf(addressId));
        response.sendRedirect("/addAddress");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doPost(request, response);
    }
}
